/*
 ============================================================================
 Page	     : 448
 Name        : friend.c
 Date	     : 20210407
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 嵌套结构示例
 ============================================================================
 */

#include <stdio.h>
#define LEN 20
const char *message[5] =
{
	"    Thank you for the wonderful evening, ",
	"You certainly prove that a ",
	"is a special kind of guy. We must get together",
	"over a delicious ",
	" and have a few laughs"
};

struct names			// 第1个结构
{
	char first[LEN];
	char last[LEN];
};

struct guy					// 第2个结构
{
	struct names handle;	// 嵌套结构
	char favfood[LEN];
	char job[LEN];
	float income;
};

int main(void)
{
	struct guy fellow = {		// 初始化一个结构变量
			{ "Ewen", "Villard" },
			"grilled salmon",
			"personality coach",
			68112.00
	};

	printf("Dear %s, \n\n", fellow.handle.first);
	printf("%s%s.\n", message[0], fellow.handle.first);
	printf("%s%s\n", message[1], fellow.job);
	printf("%s\n", message[2]);
	printf("%s%s%s", message[3], fellow.favfood, message[4]);
	if(fellow.income > 150000.0)
	{
		puts("!!");
	}
	else if(fellow.income > 75000.0)
	{
		puts("!");
	}
	else
	{
		puts(".");
	}
	printf("\n%40s%s\n", " ", "See you soon,");
	printf("%40s%s\n", " ", "Shalala");

	return 0;
}

